LM BUILD LIGHT MAPS

This command starts the process of calculating lightmaps for every light map object that has been added and can take some time.

  Syntax
LM Build Light Maps Texture Size, Quality, Blur Radius 

  Parameters

Texture Size 
The resolution you want to use for the lightmaps, minimum of 32.

Quality
The quality of the lightmaps, defined in lightmap pixels per DarkBasic unit.

Blur Radius
The amount of blurring to apply to shadows.

  Returns

This command does not return a value.

  Description

It provides three parameters that contribute to how the lightmaps will look and consequently how long it may take to calculate. The Texture Size parameter defines the resolution of the lightmaps that are created, this can be anywhere from 32 (for 32x32) up to the maximum value your graphics card supports (for modern cards this is about 4096x4096). Older cards such as Geforce2 and Geforce4MX support a texture value up to 2048. For maximum compatibility it is advised you set this value to a power of 2, i.e. 32,64,128,256,512,1024, or 2048. Every object you added will be made up of at least one DarkBasic limb, each limb must fit entirely within a lightmap texture, if you chose a small texture size you may get a warning that some limbs could not fit within a texture, increasing the texture size may fix this. Texture size has little to no effect on performance. The Quality parameter determines how detailed the generated lightmaps are and generally the higher the quality the better looking the lightmap that is produced. The value itself equals the number of lightmap pixels that will cover a DarkBasic unit, for example a value of 0.2 means that a lightmap pixel (once applied to the object) will be 5 DarkBasic units in height and width (0.2 pixels per unit = 1 pixel per 5 units). This value should depend on how big your object is when viewed in DarkBasic, if 5 units represents the size of a door then this quality might be too low for good looking lightmaps, on the other hand if your level is very large and 5 units is only the width of a pen on a desk then (depending on your needs) this quality might be too high. Quality effects how much texture space is used per polygon and high qualities can cause limbs to no longer fit on the specified texture size, lower qualities or (as above) higher texture sizes may fix this. Quality has a large impact on the time it takes to calculate lightmaps and generally speaking doubling the quality quadruples the time to calculate the lightmap, but produces better looking results. The Blur Radius parameter sets how much blurring occurs on shadows. Depending on the quality setting the border between shadowed and non-shadowed areas can have a blocky appearance, blurring can reduce this effect without needing to increase the quality. Valid blur modes are from 0-3, the following shows the effect of different blur modes, the blur mode is stated in the corner of each picture.



The blur mode has a slight effect on performance, the larger the blur radius the longer it will take to calculate. Another way to reduce blocky shadows is to use area lights as opposed to point lights, these are detailed in the information section of the help file.